package io.mvvm.security.handler;

import io.mvvm.security.service.IUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class UserDetailsHandler implements UserDetailsService {

    @Resource
    private IUserDetailsService iUserDetailsService;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        UserDetails userDetails = iUserDetailsService.loadUserByUsername(username);

        return userDetails;
    }
}